package cn.itcast.web.controller.system;

import cn.itcast.domain.system.SysLog;
import cn.itcast.domain.system.Module;
import cn.itcast.domain.system.SysLog;
import cn.itcast.service.system.SysLogService;
import cn.itcast.service.system.ModuleService;
import cn.itcast.service.system.SysLogService;
import cn.itcast.web.controller.BaseController;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/system/log")
public class SysLogController extends BaseController {


    @Autowired
    private SysLogService sysLogService;


       /*
        作用 : 进入到角色分页列表中
        url:    /system/sysLog/list.do
        参数： 当前页， 页面大小
        返回值： system/sysLog/sysLog-list
     */


       @RequestMapping("/list")
       public String list(@RequestParam(defaultValue = "1")Integer pageNum,
                          @RequestParam(defaultValue = "5")Integer pageSize){
           //companyId应该是属于登陆的角色所属的企业，由于我们当前还没有做登陆功能，所以我们只能模拟

           String companyId = getLoginUserCompanyId();
           PageInfo<SysLog> pageInfo = sysLogService.findByPage(pageNum, pageSize, companyId);


           //存储到request域中
           request.setAttribute("pageInfo",pageInfo);
           return "system/log/log-list";

       }


}
